package com.xjtu.shopcar.domin;

import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

public class Car {
 Map<String, Item>  bookMap = new LinkedHashMap<>();
 private double totalPrice;
public Car() {
	super();
}
public Map<String, Item> getBookMap() {
	return bookMap;
}
public void setBookMap(Map<String, Item> bookMap) {
	this.bookMap = bookMap;
}
public double getTotalPrice() {
double sum = 0.0;
Set<Entry<String, Item>> set = bookMap.entrySet();
Iterator<Entry<String, Item>> iterator = set.iterator();
while(iterator.hasNext()){
           Entry<String, Item> entry = iterator.next();
           String  key = entry.getKey();
           Item  item = bookMap.get(key);
           sum  =  sum + item.getItemNum()  * item.getBook().getPrice();
	
}
   totalPrice = sum;
	return totalPrice;
}
public void setTotalPrice(double totalPrice) {
	this.totalPrice = totalPrice;
}
 
 }
